<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt'%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>

<c:if test="${list ne null && list eq 'material'}">
<script>
	$(function(){
		$("#export_confer").click(function(){
			$.post("app/conference.do?action=actionExportConference", {
				"title"				: $("#q_confTitle").val(),
				"attendee.username"	: $("#q_attendee").val(),
			}, function(rsp){
				var feedback = eval('(' + rsp + ')');
				if (feedback.status && feedback.status == 200) 
				{
					var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no,resizable=yes,personalbar=no,scrollbars=yes"; 
					window.open("file-download?path="+feedback.file+"&filename="+feedback.name, "_blank",  windowAttr);
				} 
				else 
				{
					// error message migtht be raised here.
					alert(feedback.message);
				}
			});
		});
	});
</script>
</c:if>

<form id="pagerForm" method="post" action="app/conference.do?action=pageConferenceList">
	<input type="hidden" name="pageNum" value="${pagingBean ne null ? pagingBean.currentPage : 1}" />
	<input type="hidden" name="numPerPage" value="${pagingBean ne null ? pagingBean.pageSize : 20}" />
</form>

<!-- SearchBar -->
<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" action="app/conference.do?action=pageConferenceList" 
		method="post" id="searchForm" rel="pagerForm">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>
						<label>会议名称：</label>
						<input id="q_confTitle" type="text" name="title" rel="pagerForm" value="${title ne null ? title : ''}" />
					</td>
					<td>
						<label>参会人：</label>
						<input id="q_attendee" type="text" name="attendee.username" rel="pagerForm" value="${attendeeName ne null ? attendeeName : ''}" postField="search" 
								suggestFields="username,userNo" suggestUrl="app/base.do?action=lookupUserByName" lookupGroup="attendee" />
					</td>
					<c:if test="${list eq null || list eq ''}">
						<td>
							<label>审批状态：</label>
							<select name="status" class="combox">
								<option value="">所有</option>
								<option value="0" ${status eq 0 ? 'selected' : ''}>审批中</option>
								<option value="1" ${status eq 1 ? 'selected' : ''}>已通过</option>
								<option value="2" ${status eq 2 ? 'selected' : ''}>未通过</option>
								<option value="-1" ${status eq -1 ? 'selected' : ''}>已退回</option>
							</select>
						</td>
					</c:if>
					<input type="hidden" name="list" rel="pagerForm" value="${list ne null ? list : ''}" />
				</tr>
			</table>
			<div class="subBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
				</ul>
			</div>
		</div>
	</form>
</div>

<!-- Body -->	
<div class="pageContent">
	
	<c:if test="${list ne null && list eq 'material'}">
	<div class="panelBar">
		<ul class="toolBar">
			<li>
				<a class="icon" id="export_confer" href="javascript:void(0);" title="导出会议资料列表">
					<span>导出</span>
				</a>
			</li>
		</ul>
	</div>
	</c:if>
	
	<%@ include file="datagrid/dataGridConference.jsp" %>
</div>